package com.example.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alipay.sofa.runtime.api.annotation.SofaReference;
import com.alipay.sofa.runtime.api.annotation.SofaReferenceBinding;
import com.example.service.UserService;
import com.example.vo.UserVO;

import cn.hutool.json.JSONUtil;

@RestController
@RequestMapping("/api")
public class ApiController {

//	@SofaReference(uniqueId = "userService")
//    private UserService userService;

	@SofaReference(interfaceType = UserService.class, jvmFirst = false, binding = @SofaReferenceBinding(bindingType = "bolt"))//registry="zookeeper://127.0.0.1:2181"
	private UserService userService;

	@RequestMapping("/user/profile")
	public UserVO profile() {
		UserVO user = userService.profile("sim");

		System.err.println(JSONUtil.toJsonPrettyStr(user));
		return user;
	}
}